package futbol.tacticas.concursantes.laponiafc;

import java.awt.geom.Point2D;

/**
 * 
 * @author Galderic Punti
 * 
 * @date 06-06-2008
 * 
 */
public abstract class Movimiento {

	protected Point2D.Double origin = new Point2D.Double();

	Point2D.Double cur = new Point2D.Double();

	private int speed;
	final Util help = Util.getInstance();

	public void reset() {
		origin.setLocation(0, 0);
		cur.setLocation(0, 0);

	}

	public Movimiento(double x0, double y0, double x1, double y1, int speed) {

		cur.setLocation(x0, y0);
		origin.setLocation(x0, y0);

		this.speed = speed;
	}

	public Movimiento(double x0, double y0, double x1, double y1) {

		this(x0, y0, x1, y1, 1);

		double dx = x1 - x0;
		double dy = y1 - y0;

		this.speed = (int) Math.round(Math.sqrt(dx * dx + dy * dy));

	}

	public final int getSpeed() {

		return speed;
	}

	public final void setSpeed(int v) {

		this.speed = v;
	}

	public abstract void addPoint(double x, double y, Jugador[] players);

}
